package game;


import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;

/**
 * Spielerbalken - bewegbar.
 * 
 * @author mariuswi
 */
public class Racket implements  Drawable, Networkable{
    
    //Attribute
    private Rectangle area;
    private float speedx;
    private float speedy;

    
    //Methoden
    Racket(int posx, int posy, int width, int height){
        this.area = new Rectangle(posx, posy, width, height);
        this.speedx = 0;
        this.speedy = 0;
    }


    @Override
    public void draw(GameContainer container, Graphics g) {
        g.setColor(Color.white);
        g.fillRect(area.getTopx()*GuiPlay.XFACTOR, area.getTopy()*GuiPlay.YFACTOR, area.getWidth()*GuiPlay.XFACTOR, area.getHeight()*GuiPlay.YFACTOR);
    }
    
    @Override
    public Rectangle getArea () {
        return this.area;
    }
    
    public float getSpeedx() {
        return speedx;
    }

    public void setSpeedx(float speedx) {
        this.speedx = speedx;
    }

    public float getSpeedy() {
        return speedy;
    }

    public void setSpeedy(float speedy) {
        this.speedy = speedy;
    }

    void moveAStep() {
        this.area.setPosition(area.getTopx() + (int)this.speedx, area.getTopy() + (int)this.speedy);
    }

}
